package com.ldatum.crm.serviceImpl;

import java.sql.SQLException;
import java.util.List;

import com.ldatum.crm.dao.MedicineDao;
import com.ldatum.crm.daoImpl.MedicineDaoImpl;
import com.ldatum.crm.domain.Cart;
import com.ldatum.crm.domain.Medicine;
import com.ldatum.crm.service.MedicineService;

public class MedicineServiceImpl implements MedicineService {

	
	MedicineDao medicineDao = new MedicineDaoImpl();
	@Override
	public int save(Medicine medicine) throws SQLException {
		return medicineDao.save(medicine);
	}

	@Override
	public List<Medicine> list() throws SQLException {
		return medicineDao.list();
	}

	@Override
	public Medicine queryById(int me_id) throws SQLException {
		return medicineDao.queryById(me_id);
	}

	@Override
	public int deletes(String ids) throws SQLException {
		ids = ids.substring(0, ids.length()-1);
		return medicineDao.deletes(ids);
	}

	@Override
	public List<Cart> findAmountAndPriceByIds(String ids,String level,String idCart) throws Exception {
		List<Cart> list = medicineDao.findAmountAndPriceByIds(ids,level);
//		if(!"".equals("idCart")){
//			for(Cart cart:list){
//				
//			}
//		}
//		
//		
		return list;
	}

	@Override
	public int update(Medicine medicine) throws SQLException {
		return medicineDao.update(medicine);
	}

	@Override
	public int findTodayMedicines() throws Exception {
		return medicineDao.findTodayMedicines();
	}

	@Override
	public List<Medicine> listByInventory() throws Exception {
		return medicineDao.listByInventory();
	}

}
